package com.guessgame.referee;

import com.guessgame.pojo.Result;

/**
 * @program:
 * @author: Jiuly
 * @date: 2022/5/15 20:46
 * @Description
 */
public class Judge implements JudgeInterface{

    @Override
    public Result end(int computer, int player) {
        Result result = new Result();
        if (((computer - player) + 3) % 3 == 1) {
            result.setWin(1);
        }
        else if (((computer - player) + 3) % 3 == 2) {
            result.setFail(1);
        }
        else {
            result.setDraw(1);
        }
        return result;
    }
}
